package com.lfz.quality_effect.controller;



import com.lfz.quality_effect.model.dto.IsSendDTO;
import com.lfz.quality_effect.model.vo.*;
import com.lfz.quality_effect.service.TFamilyTrialService;
import com.lfz.quality_effect.utils.ResultData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


import java.util.List;

import static com.lfz.quality_effect.utils.ReturnCode.RC500;


@Api(tags = "家事审判",value = "TFamilyTrialController")
@RestController
@RequestMapping("/api/familyTrial")
public class TFamilyTrialController {



    @Autowired
    private TFamilyTrialService tFamilyTrialService;


    @ApiOperation("家事审判——上传收结存表")
    @PostMapping("/uploadFamilyTrial")
    public ResultData uploadFamilyTrial(@RequestParam("file") MultipartFile file){
        tFamilyTrialService.uploadFamilyTrial(file);
        return ResultData.ok();
    }


    @ApiOperation("获取受理趋势")
    @PostMapping("/getAcceptTrend")
    public ResultData getAcceptTrend(@RequestBody IsSendDTO isSendDTO){
        String isSend = isSendDTO.getIsSend();
        List<AcceptTrendVO> list =  tFamilyTrialService.getAcceptTrend(isSend);
        return ResultData.ok().data(list);
    }


    @ApiOperation("获取调解撤诉趋势")
    @PostMapping("/getMediateAndWithdrawTrend")
    public ResultData getMediateAndWithdrawTrend(@RequestBody IsSendDTO isSendDTO){
        String isSend = isSendDTO.getIsSend();
        List<MediateWithdrawVO> list =  tFamilyTrialService.getMediateAndWithdrawTrend(isSend);
        return ResultData.ok().data(list);
    }


    @ApiOperation("获取案由分布")
    @PostMapping("/getCaseActionDistribution")
    public ResultData getCaseActionDistribution(@RequestBody IsSendDTO isSendDTO){
        String isSend = isSendDTO.getIsSend();
        List<CaseActionVO> list =  tFamilyTrialService.getCaseActionDistribution(isSend);
        return ResultData.ok().data(list);
    }


    @ApiOperation("获取地理分布")
    @PostMapping("/getLocationDistribution")
    public ResultData getLocationDistribution(){
        List<LocationVO> list =  tFamilyTrialService.getLocationDistribution();
        return ResultData.ok().data(list);
    }


    @ApiOperation("获取案件总数(历史/当年)")
    @PostMapping("/getTotalCaseNumGroupByCourt")
    public ResultData getTotalCaseNumGroupByCourt(@RequestBody IsThisYearVO isThisYearVO){
        List<CaseNumByCourtVO> list =  tFamilyTrialService.getTotalCaseNumGroupByCourt(isThisYearVO);
        return ResultData.ok().data(list);
    }




}
